<?php
	$shiftID = $_POST['shiftID'];
	
	$conn = new mysqli('localhost', 'root', '', 'sevenbits');
    $sql = "DELETE FROM shifts WHERE shiftID = '$shiftID'";
    $conn->query($sql);

	$sql = "SELECT * FROM shifts";
	$result = $conn->query($sql);
	// if the $result contains at least one row
	if ($result->num_rows > 0) {
		$arrResults = array();
	  // output data of each row from $result
	  while($row = $result->fetch_assoc()) {
		$arrResults[] = array(
			'ShiftID' => $row['ShiftID'],
			'ShiftName' => $row['ShiftName']);
	  // echo '<br /> id: '. $row['ShiftID']. ' - name: '. $row['ShiftName'] ;
	  }
	  echo json_encode($arrResults);
	}
	else {
	  echo '0 results';
	}
?>